![]() |
KCAddGenericPassword |
||||
Header: | Keychain.h | Carbon status: | Under Evaluation | |
Adds a new generic password to the default keychain.
OSStatus KCAddGenericPassword ( StringPtr serviceName, StringPtr accountName, UInt32 passwordLength, const void *passwordData, KCItemRef *item );
A pointer to a Pascal string containing an application-defined service name.
A pointer to a Pascal string containing an application-defined account name.
The length of the password data to be stored.
A pointer to a buffer which will hold the returned password data. Before calling KCAddGenericPassword, allocate enough memory for the buffer to hold the data you want to store.
On return, a pointer to a reference to the added item. Pass NULL if you don’t want to obtain this reference.
A result code. The result code errKCNoDefaultKeychain indicates that no default keychain could be found. The result code errKCDuplicateItem indicates that you tried to add a password that already exists in the keychain. The result code errKCDataTooLarge indicates that you tried to add more data than is allowed for a record of this type.
The KCAddGenericPassword function adds a new generic password to the default keychain. Required parameters to identify the password are serviceName and accountName, which are application-defined strings. KCAddGenericPassword optionally returns a reference to the newly added item.
You can use KCAddGenericPassword to add passwords for accounts other than Internet or Appleshare. For example, you might add passwords for your database or scheduling programs.
Available beginning with Keychain Manager 1.0. In Keychain Manager 1.0, the kcaddgenericpassword function provides the same functionality as KCAddGenericPassword, except that it accepts C strings rather than Pascal strings as arguments. In Keychain 2.0, you should use KCAddGenericPassword, since kcaddgenericpassword is provided for convenience only and may be removed from the header file at some point in the future.
Under evaluation for Carbon. Available in CarbonLib 1.0 and later when KeychainLib 1.0 or later is installed. Exported by CarbonLib 1.0 and later and by KeychainLib 1.0 and later.
© 2000 Apple Computer, Inc. — (Last Updated 4/14/2000)